//
//  RLHttpRequestLayer.m
//  CodeForANF2
//
//  Created by relax on 2017/11/15.
//  Copyright © 2017年 relax. All rights reserved.
//

#import "RLHttpRequestLayer.h"
#import "RLInterfaceConst.h"
#import "RLNetworkHelper.h"

@implementation RLHttpRequestLayer

/** 登陆 */
+ (__kindof NSURLSessionTask *)getLoginParams:(NSDictionary *)params success:(RLRequestSuccessBlock)successBlock failureBlock:(RLRequestFailureBlock)failureBlock {
    // 拼接登陆链接
    NSString *loginURL = [NSString stringWithFormat:@"%@%@",kApiPrefix,kLogin];
    return [RLNetworkHelper POST:loginURL parameters:params success:^(id responseObject) {
        successBlock ? successBlock(responseObject) : nil;
    } failure:^(NSError *error) {
        failureBlock ? failureBlock(error) : nil;
    }];
}

/** 登出 */
+ (NSURLSessionTask *)getExitWithParams:(NSDictionary *)params success:(RLRequestSuccessBlock)successBlock failureBlock:(RLRequestFailureBlock)failureBlock {
    NSString *exitURL = [NSString stringWithFormat:@"%@%@",kApiPrefix,kExit];
    return [RLNetworkHelper GET:exitURL parameters:params success:^(id responseObject) {
        successBlock ? successBlock(responseObject) : nil;
    } failure:^(NSError *error) {
        failureBlock ? failureBlock(error) : nil;
    }];
}

@end
